<!-- src/views/dashboard/components/UserProfileCard.vue -->
<template>
  <el-card class="profile-card" shadow="hover">
    <div class="avatar">
      <el-avatar :src="user.photo" :size="80" />
    </div>
    <div class="info">
      <div class="name">{{ user.realName }}</div>
      <div class="role">{{ roleText }}</div>
      <div class="campus">
        <el-icon><Location /></el-icon>
        <span>{{ user.campus.name }}</span>
      </div>
    </div>
  </el-card>
</template>

<script setup>
import { useAuthStore } from '@/stores/auth'
import { computed } from 'vue'
import { Location } from '@element-plus/icons-vue'

const authStore = useAuthStore()
const user = authStore.user

const roleText = computed(() => {
  const map = {
    student: '学员',
    coach: '教练',
    admin: user.isSuperAdmin ? '超级管理员' : '校区管理员'
  }
  return map[user.userType] || '未知角色'
})
</script>

<style scoped lang="scss">
.profile-card {
  text-align: center;
  padding: 20px;

  .avatar {
    margin-bottom: 12px;
  }

  .info {
    .name {
      font-size: 18px;
      font-weight: bold;
      margin-bottom: 4px;
    }

    .role {
      font-size: 14px;
      color: #409eff;
      margin-bottom: 8px;
    }

    .campus {
      font-size: 13px;
      color: #666;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
    }
  }
}
</style>